//
// Created by klen on 23-11-25.
//
#include <memory>  // for allocator, __shared_ptr_access, shared_ptr
#include <string>  // for string, basic_string
#include <vector>  // for vector

#include "ftxui/component/captured_mouse.hpp"  // for ftxui
#include "ftxui/component/component.hpp"  // for Radiobox, Horizontal, Menu, Renderer, Tab
#include "ftxui/component/component_base.hpp"      // for ComponentBase
#include "ftxui/component/screen_interactive.hpp"  // for ScreenInteractive
#include "ftxui/dom/elements.hpp"  // for Element, separator, hbox, operator|, border

int main() {
    using namespace ftxui;

    // 网格布局, 将所有元素水平排列
    auto cell = [](const char* t) { return text(t) | border; };
    auto elm = gridbox({
                                    {cell("north-west") , cell("north")  , cell("north-east")} ,
                                    {cell("west")       , cell("center") , cell("east")}       ,
                                    {cell("south-west") , cell("south")  , cell("south-east")} ,
                            });

    // 创建一个屏幕, 宽度为全屏, 高度根据元素大小伸展
    auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(elm));

    // 将元素设置在屏幕对象中展现
    Render(screen, elm);

    // 打印屏幕
    screen.Print();

}